<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div style="display: flex;">
        <!-- 搜索 -->
        <label class="el-form-item-label">物料编号</label>
        <el-input v-model="query.materialCode" clearable placeholder="物料编号" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">物料描述</label>
        <el-input v-model="query.materialDescription" clearable placeholder="物料描述" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <label class="el-form-item-label">容器类型</label>
        <el-input v-model="query.containerType" clearable placeholder="容器类型" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
        <rrOperation :crud="crud" />
        <!-- <div style="margin-left: 5px;">
          <el-button type="success" size="mini" icon="el-icon-search" @click="crud.toQuery">搜索</el-button>
          <el-button type="warning" size="mini" icon="el-icon-refresh-right" @click="reset">重置</el-button>
        </div> -->
      </div>
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <!-- <crudOperation :permission="permission" /> -->
      <!--表格渲染-->
      <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
        <!-- <el-table-column type="selection" width="55" /> -->
        <el-table-column prop="materialCode" label="物料编号" />
        <el-table-column prop="materialDescription" label="物料描述" />
        <el-table-column prop="qty" label="数量" />
        <el-table-column prop="realQty" label="实际出库数量" />
        <el-table-column prop="containerType" label="容器类型" />
        <el-table-column prop="parentPalletCode" label="母托编码" />
        <el-table-column prop="status" label="状态" />
        <el-table-column prop="parentPalletId" label="母托id" />
        <el-table-column prop="storageId" label="储位id" />
        <el-table-column prop="createTime" label="创建时间" />
        <el-table-column prop="otherOutboundOrderId" label="other出库单id（外键）" />
        <!-- <el-table-column v-if="checkPer(['admin','otherOutboundOrderDetail:edit','otherOutboundOrderDetail:del'])" label="操作" width="150px" align="center">
          <template slot-scope="scope">
            <udOperation
              :data="scope.row"
              :permission="permission"
            />
          </template>
        </el-table-column> -->
      </el-table>
      <!--分页组件-->
      <pagination />
    </div>
  </div>
</template>

<script>
import crudOtherOutboundOrderDetail from '@/api/work/containerOutboundOrderDetail'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
// import crudOperation from '@crud/CRUD.operation'
// import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, materialCode: null, materialDescription: null, qty: null, realQty: null, containerType: null, parentPalletCode: null, status: null, parentPalletId: null, storageId: null, createTime: null, createName: null, updateTime: null, updateName: null, otherOutboundOrderId: null }
export default {
  name: 'ContainerOutboundDetail',
  components: { pagination, rrOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: 'otherOutboundOrderDetail', url: 'api/otherOutboundOrderDetail', idField: 'id', sort: 'id,desc', crudMethod: { ...crudOtherOutboundOrderDetail },
      queryOnPresenterCreated: true
    })
  },
  data() {
    return {
      permission: {
        add: ['admin', 'otherOutboundOrderDetail:add', 'otherUser'],
        edit: ['admin', 'otherOutboundOrderDetail:edit', 'otherUser'],
        del: ['admin', 'otherOutboundOrderDetail:del', 'otherUser']
      },
      rules: {
      },
      queryTypeOptions: [
        { key: 'materialCode', display_name: '物料编号' },
        { key: 'materialDescription', display_name: '物料描述' },
        { key: 'containerType', display_name: '容器类型' }
      ]
      // otherOutboundOrderNo: ''
    }
  },
  mounted() {
    this.crud.toQuery()
  },
  created() {
    // this.query.otherOutboundOrderId = this.$route.query.id
    // this.otherOutboundOrderNo = this.$route.query.otherOutboundOrderNo
  },
  methods: {
    // 钩子：在获取表格数据之前执行，false 则代表不获取数据
    [CRUD.HOOK.beforeRefresh]() {
      this.query.otherOutboundOrderId = this.$route.query.id
      return true
    }
    // reset() {
    //   this.query.materialCode = ''
    //   this.query.materialDescription = ''
    //   this.query.containerType = ''
    //   this.crud.toQuery()
    // }
  }
}
</script>

<style scoped>

</style>
